package com.example.academic_affairs_system.model.dto.classCourses;

import cn.hutool.core.util.StrUtil;
import com.example.academic_affairs_system.model.entity.AasCourses;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 班级课程 dto
 *
 * @author hjx
 * @since 2023/02/03 7:18 PM
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("班级课程 dto")
public class ClassCoursesDTO {
  @ApiModelProperty("班级 id")
  Long classId;

  @ApiModelProperty("课程 id")
  Long coursesId;

  @ApiModelProperty("班级代码")
  private String classCode;

  @ApiModelProperty("课程名称")
  private String name;

  @ApiModelProperty("课程性质")
  private String type;

  @ApiModelProperty("课程描述")
  private String desc;

  public boolean updateMsg() {
    return StrUtil.isNotBlank(name) || StrUtil.isNotBlank(type) || StrUtil.isNotBlank(desc);
  }

  public boolean updateRelated() {
    return classId != null && coursesId != null;
  }

  public AasCourses buildCourses() {
    return AasCourses.builder().name(name).type(type).desc(desc).build();
  }
}
